<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    let arr = [5,7,[8,9,[10,11]]];
    let obj1 = {
        name: '张三',
        project: {
            name: '数学',
            kind: {
                'name1': '高等数学',
                'name2': '线性代数'
            }
        }
    }
    function checkType(obj) {
        return Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();
    }
    
    // let o = null;
    function deepCopy(obj) {
        if(checkType(obj) === 'array') {
            var o = [];
        } else if (checkType(obj) === 'object') {
            var o = {};
        } else {
            return obj;
        }
        for (var key in obj) {
            console.log('1111',key)
            o[key] = deepCopy(obj[key])
        }
        return o;
    }
    console.log(deepCopy(obj1));
</script>
</html>